package com.xiaoyu.lib_av.datamodel

import androidx.annotation.StringDef

import io.agora.rtm.RtmStatusCode.LocalInvitationError.*

object CallFailType {

    const val ILLEGAL_ARGUMENT = "illegal_argument"
    const val NOT_LOGIN = "not_login"
    const val NO_RESPONSE = "no_response"
    const val UNKNOWN = "unknown"

    fun fromAgoraLocalInviteCallError(code: Int): String {
        when (code) {
            LOCAL_INVITATION_ERR_PEER_NO_RESPONSE, LOCAL_INVITATION_ERR_PEER_OFFLINE, LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> return NO_RESPONSE
            LOCAL_INVITATION_ERR_NOT_LOGGEDIN -> return NOT_LOGIN
            else -> return UNKNOWN
        }
    }

    @StringDef(ILLEGAL_ARGUMENT, NOT_LOGIN, NO_RESPONSE, UNKNOWN)
    annotation class CallFailTypeDef
}
